﻿@using WebAPP_LIULI.Models;
@{
    User user = (User)Session["User"];
    List<OrderRepository> rsList = ViewBag.rsList;
}

<!-- Page-Title -->
<div class="row">
    <div class="col-sm-12">

        <h2 class="page-title">生产报表</h2>
    </div>
</div>
<!-- end page title end breadcrumb -->




<div class="row">

    <div class="col-xl-3 col-md-6 col-6">
        <div class="card-box widget-user">
            <div class="text-center">
                <h2 class="text-custom" data-plugin="counterup">@ViewBag.AllorderCount </h2>
                <h5>总订单数/吨</h5>
            </div>
        </div>
    </div>

    <div class="col-xl-3 col-md-6 col-6">
        <div class="card-box widget-user">
            <div class="text-center">
                <h2 class="text-warning" data-plugin="counterup">@ViewBag.Respository </h2>
                <h5>库存吨位/吨</h5>
            </div>
        </div>
    </div>

    <div class="col-xl-3 col-md-6 col-6">
        <div class="card-box widget-user">
            <div class="text-center">
                <h2 class="text-success" data-plugin="counterup">@ViewBag.MonthProductions </h2>
                <h5>本月产量/吨</h5>
            </div>
        </div>
    </div>

    <div class="col-xl-3 col-md-6 col-6">
        <div class="card-box widget-user">
            <div class="text-center">
                <h2 class="text-danger" data-plugin="counterup">@ViewBag.todayProduction </h2>
                <h5>今日产量/吨</h5>
            </div>
        </div>
    </div>

    <div class="col-xl-3 col-md-6">
        <div class="card-box widget-user">
            <div class="text-center">
                <table class="table">
                    <thead>
                        <tr>
                            <th width="30%">班组产量</th>
                            <th width="35%">占比</th>
                            <th width="35%">废品率</th>
                        </tr>
                    </thead>
                    <tbody>

                        @foreach (TeamProduction tp in ViewBag.tpList)
                        {
                            <tr>
                                <td><h3>@tp.ProductCount 吨</h3>@tp.Team</td>
                                <td>
                                    <div class="widget-chart-box-1">
                                        <input data-plugin="knob" data-width="80" data-height="80" data-fgColor="#f05050 "
                                               data-bgColor="#F9B9B9" value="@tp.ProductRate.ToString("0.00")"
                                               data-skin="tron" data-angleOffset="180" data-readOnly=true
                                               data-thickness=".15" />
                                    </div>
                                </td>
                                <td>
                                    <div class="widget-chart-box-1">
                                        <input data-plugin="knob" data-width="80" data-height="80" data-fgColor="#f05050 "
                                               data-bgColor="#F9B9B9" value="@tp.ScrapRate.ToString("0.00")"
                                               data-skin="tron" data-angleOffset="180" data-readOnly=true
                                               data-thickness=".15" />
                                    </div>
                                </td>
                            </tr>
                        }



                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="col-xl-3 col-md-6">
        <div class="card-box widget-user">
            <div class="text-center">
                <table class="table">
                    <thead>
                        <tr>
                            <th width="35%">产品名称</th>
                            <th width="35%">今日产品</th>
                            <th width="30%">占比</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (TodayProductRate tpr in ViewBag.tprList)
                        {
                            <tr>
                                <td>@tpr.ProductName</td>
                                <td>@tpr.ProductCount 吨</td>
                                <td>
                                    <p class="font-600 m-b-5"> <span class="text-primary pull-right">@tpr.ProductRate.ToString("0.00") %</span></p>
                                    <div class="progress progress-bar-primary-alt progress-sm m-b-20">
                                        <div class="progress-bar progress-bar-primary progress-animated wow animated animated" role="progressbar" aria-valuenow="@tpr.ProductRate.ToString("0.00")" aria-valuemin="0" aria-valuemax="100" style="width: @tpr.ProductRate.ToString("0.00")%; visibility: visible; animation-name: animationProgress;">
                                        </div><!-- /.progress-bar .progress-bar-danger -->
                                    </div>
                                </td>
                            </tr>
                        }

                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div class="col-xl-6">
        <div class="card-box">

            <h4 class="header-title m-t-0 m-b-30">产品未交付订单-库存对比图</h4>

            <div class="text-center">
                <ul class="list-inline chart-detail-list">
                    <li class="list-inline-item">
                        <h5 style="color: #5b69bc;"><i class="fa fa-circle m-r-5"></i>订单量</h5>
                    </li>
                    <li class="list-inline-item">
                        <h5 style="color: #35b8e0;"><i class="fa fa-circle m-r-5"></i>库存</h5>
                    </li>
                </ul>
            </div>
            <div id="morris-bar-example" style="height: 300px;"></div>
        </div>
    </div><!-- end col-->

</div>
<!-- end row -->

<script>
    $(document).ready(function () {
        var $barData = [
            @{
                foreach (OrderRepository rs in rsList)
                {
                    <text>{y:'@rs.ProductName',a:@rs.OrderCount ,b:@rs.RepositoryCount}</text>
                    if (rsList.Last() != rs)
                    {
                        <text>,</text>
                    }
                }
            }
        ];

        Morris.Bar({
            element: 'morris-bar-example',
            data: $barData,
            xkey: 'y',
            ykeys: ['a','b'],
            labels: ['订单量','库存'],
            hideHover: 'auto',
            resize: true, //defaulted to true
            gridLineColor: '#eeeeee',
            barSizeRatio: 0.4,
            barColors: [ '#5b69bc','#35b8e0']
        });

    });
</script>